// 1491. 去掉最低工资和最高工资后的工资平均值


#include <iostream>
#include <vector>
using namespace std;

class Solution
{
public:
    double average(vector<int>& salary)
    {
        int max = 0, min = INT_MAX, sum = 0;
        for(auto& e : salary)
        {
            sum += e;
            if(max < e) max = e;
            if(min > e) min = e;
        }
        sum -= (max + min);
        return (double)sum / (salary.size() - 2);
    }
};